package cn.pdx.elec.web.action;




import java.util.List;

import cn.pdx.elec.container.ServiceProvider;
import cn.pdx.elec.service.ElecSystemDDlService;
import cn.pdx.elec.web.form.ElecSystemDDlForm;

import com.opensymphony.xwork2.ModelDriven;

/**
 * implements ModelDriven<T>实现这个接口，泛型
 * ModelDriven<ElecSystemDDlForm>表示这个表单对象
 * @author 彭定旭
 *
 */
@SuppressWarnings("serial")
public class ElecSystemDDlAction extends BaseAction implements  ModelDriven<ElecSystemDDlForm>{
    
	/**
	 * 创建一个表单对象，对应页面的属性的对象
	 */
	private ElecSystemDDlForm elecSystemDDlForm=new ElecSystemDDlForm();
	
	/**
	 * 使用方法调用ElecSystemDDlService.SERVICE_NAME 接口
	 */
	@SuppressWarnings("unused")
	private ElecSystemDDlService elecSystemDDlService=(ElecSystemDDlService) ServiceProvider.getService(ElecSystemDDlService.SERVICE_NAME);
	
	
	public ElecSystemDDlForm getModel() {
		
		return elecSystemDDlForm;
	}
    
	
	/**
	 * @Name:home
	 * @Description:查询数据类型
	 * @author 彭定旭
	 * @version：v1.00（版本号）
	 * @Create Date:2013-3-30(创建日期)
	 * @parameters:
	 * @return: String home 跳转到 dictionaryIndex.jsp
	 * 
	 */
	public String home()
	{   
		List<ElecSystemDDlForm> list=elecSystemDDlService.findKeyWord();
		
		request.setAttribute("systemList", list);
		
		return "home";
	}
  
	
	/**
	 * @Name:edit
	 * @Description:根据选中的类型,跳转到编辑此数据类型的页面
	 * @author 彭定旭
	 * @version：v1.00（版本号）
	 * @Create Date:2013-4-1(创建日期)
	 * @parameters:
	 * @return: String edit 跳转到 dictionaryEdit.jsp
	 * 
	 */
	   public String edit()
	   {   
		   //获取传递过来的数据类型
		   String keyword=elecSystemDDlForm.getKeyword();
		   
		   List<ElecSystemDDlForm> list=elecSystemDDlService.findElecSystemDDlListByKeyword(keyword);
		   
		   request.setAttribute("systemList", list);
		   
		   return "edit";
		   
	   }
	   
	   
	   /**
	    * @Name:save
	    * @Description:保存数据字典
	    * @author 彭定旭
	    * @version：v1.00（版本号）
	    * @Create Date:2013-4-2(创建日期)
	    * @parameters:
	    * @return: String save 重定向到dictionaryIndex.jsp
	    * 
	    */
	   public String save()
	   {   
		   
		   elecSystemDDlService.saveElecSystemDDl(elecSystemDDlForm);
		   
		   return "save";
		   
	   }
	   
	
}
